home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CShotHellFire.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  6.3 KB  |  229 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.*;
  4.    import Local.Game.World.Map.*;
  5.    import Local.Game.World.Map.Cell.*;
  6.    import Local.Math.*;
  7.    import STC9.System.*;
  8.    import flash.display.*;
  9.    import flash.events.*;
  10.    import flash.geom.*;
  11.    
  12.    public class CShotHellFire extends CShot
  13.    {
  14.        
  15.       
  16.       private var mPath:CPath;
  17.       
  18.       private var mImpactDistance:Number;
  19.       
  20.       private var mFlare:CThingAnimation;
  21.       
  22.       private var mExplode:Boolean;
  23.       
  24.       public function CShotHellFire(param1:CPosition, param2:*)
  25.       {
  26.          super(param1);
  27.          mType = "hellfire";
  28.          Process = Process_Normal;
  29.          mAngle = new CAngle();
  30.          mDelta = new CPosition();
  31.          mMaxLife = mLife = 100;
  32.          mMaxSpeed = 400 * mSpriteScalar;
  33.          mSpeed = 0;
  34.          mAcceleration = 10;
  35.          mOrientation = 1;
  36.          mShowOnMap = true;
  37.          AddAnimation("stand",HellFire,"AddSprite_Black");
  38.          AddThing(mFlare = new CThingAnimation(HellFire_Flare,"AddSprite_Scale"));
  39.          mFlare.mInvisible = true;
  40.          ┬º┬ºpush(┬º┬ºfindproperty(mTarget));
  41.          if(true)
  42.          {
  43.             ┬º┬ºpop().mTarget = param2 is CPosition ? param2 : param2.mPosition;
  44.             SetState("FOLLOWPATH");
  45.             mTrailPoints = [];
  46.             IncrementFired();
  47.             return;
  48.          }
  49.          ┬º┬ºgoto(addr86);
  50.       }
  51.       
  52.       public function State_DROP() : void
  53.       {
  54.          mDelta.y += 0.2;
  55.          mPosition.Add(mDelta);
  56.          if(mStateCount <= 0)
  57.          {
  58.             SetState("FOLLOWPATH");
  59.          }
  60.       }
  61.       
  62.       public function State_DROP_Enter() : void
  63.       {
  64.          if(true)
  65.          {
  66.             mStateCount = SECONDS / 5;
  67.          }
  68.       }
  69.       
  70.       public function Process_Die() : *
  71.       {
  72.          mDead = true;
  73.          DispatchDispose();
  74.       }
  75.       
  76.       public function State_DROP_Exit() : void
  77.       {
  78.       }
  79.       
  80.       public function State_FOLLOWPATH_Enter() : void
  81.       {
  82.          if(true)
  83.          {
  84.             mFlare.mInvisible = false;
  85.             if(true)
  86.             {
  87.                mPath = new CPath();
  88.                mPath.SetPath([mPosition,new Point((mPosition.x + mTarget.x) * 0.5,(mPosition.y + mTarget.y) * 0.45),mTarget]);
  89.             }
  90.             mPath.OrientateThing(this);
  91.          }
  92.       }
  93.       
  94.       public function State_FOLLOWPATH_Exit() : void
  95.       {
  96.       }
  97.       
  98.       public function CreateExplosion() : void
  99.       {
  100.          if(true)
  101.          {
  102.             AddThing(new CEffectExplosionMedium(mPosition,100));
  103.             if(true)
  104.             {
  105.                mDead = true;
  106.             }
  107.             DispatchDispose();
  108.          }
  109.       }
  110.       
  111.       override public function Draw() : void
  112.       {
  113.          var _loc1_:Matrix = null;
  114.          var _loc2_:Point = null;
  115.          super.Draw();
  116.          if(!mFlare.mInvisible)
  117.          {
  118.             DrawTrail(2,150);
  119.          }
  120.          _loc1_ = GetOrientationMatrix();
  121.          DrawSprite(_loc1_);
  122.          if(!mFlare.mInvisible)
  123.          {
  124.             _loc2_ = _loc1_.transformPoint(mSprite.mObjects["flare"].mPosition);
  125.             mFlare.mPosition.SetXY(_loc2_.x + mPosition.x,_loc2_.y + mPosition.y);
  126.             mFlare.mAngle.Copy(mAngle);
  127.             mFlare.Draw();
  128.          }
  129.       }
  130.       
  131.       public function Process_Normal() : void
  132.       {
  133.          var _loc1_:Point = null;
  134.          if(true)
  135.          {
  136.             Accelerate_Speed();
  137.             if(true)
  138.             {
  139.                if(Process_State != null)
  140.                {
  141.                   if(true)
  142.                   {
  143.                      Process_State();
  144.                      if(true)
  145.                      {
  146.                         addr27:
  147.                         if(mDisposed)
  148.                         {
  149.                            if(true)
  150.                            {
  151.                               return;
  152.                            }
  153.                         }
  154.                         else
  155.                         {
  156.                            if(mFlare.mInvisible ? MapMove() : MapMoveTrail())
  157.                            {
  158.                               addr43:
  159.                               if(!mMap.InMap(mPosition.x,mPosition.y))
  160.                               {
  161.                                  addr57:
  162.                                  Dispose();
  163.                               }
  164.                               ┬º┬ºgoto(addr59);
  165.                            }
  166.                            addr59:
  167.                            Process_Children();
  168.                            ┬º┬ºgoto(addr61);
  169.                         }
  170.                         ┬º┬ºgoto(addr35);
  171.                      }
  172.                      ┬º┬ºgoto(addr43);
  173.                   }
  174.                   ┬º┬ºgoto(addr57);
  175.                }
  176.                ┬º┬ºgoto(addr27);
  177.             }
  178.             ┬º┬ºgoto(addr57);
  179.          }
  180.          addr61:
  181.          _loc1_ = OrientatePoint(mSprite.mObjects["payload"].mPosition.clone(),mPosition);
  182.          if(_loc1_.y >= mLandscape.GetAltitude(_loc1_.x))
  183.          {
  184.             mPosition.SetXY(_loc1_.x,mLandscape.GetAltitude(_loc1_.x));
  185.             mExplode = true;
  186.          }
  187.          if(mDead || mExplode)
  188.          {
  189.             CreateExplosion();
  190.          }
  191.       }
  192.       
  193.       public function State_FOLLOWPATH() : void
  194.       {
  195.          var _loc1_:Number = NaN;
  196.          if(true)
  197.          {
  198.             mExplode = Math.abs(mTarget.x - mPosition.x) <= mSpeed;
  199.             if(true)
  200.             {
  201.                if(mExplode)
  202.                {
  203.                   if(true)
  204.                   {
  205.                      addr46:
  206.                      _loc1_ = mTarget.x - mPosition.x;
  207.                      if(mPath.MoveAlong(_loc1_))
  208.                      {
  209.                         mPath.OrientateThing(this);
  210.                      }
  211.                      ┬º┬ºgoto(addr66);
  212.                   }
  213.                   mExplode = true;
  214.                   ┬º┬ºgoto(addr62);
  215.                }
  216.                else
  217.                {
  218.                   ┬º┬ºpush(mSpeed);
  219.                }
  220.                ┬º┬ºgoto(addr46);
  221.             }
  222.             addr62:
  223.             ┬º┬ºgoto(addr66);
  224.          }
  225.          addr66:
  226.       }
  227.    }
  228. }
  229.